/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.pbs.strategy;

import br.com.pbs.pojos.Pessoa;
import br.com.pbs.pojos.PessoaFisica;
import br.com.pbs.pojos.PessoaJuridica;
import br.com.pbs.factory.Factory;
import br.com.pbs.interfaces.IFacadePessoa;
import br.com.pbs.interfaces.IFactoryPessoa;
import br.com.pbs.interfaces.IStrategy;

/**
 *
 * @author Luiz Segundo
 */
public class Strategy implements IStrategy{

        private Strategy(){

        }

        public static Strategy getInstance(){
                return new Strategy();
        }

        private IFactoryPessoa facatory = new Factory();

        public IFacadePessoa strategy(Pessoa p){
                if(p instanceof PessoaJuridica){
                        return facatory.getFacadePessoaJuridica();
                }else if(p instanceof PessoaFisica){
                        return facatory.getFacadePessoaFisica();
                }else{
                        return facatory.getFacadePessoa();
                }               
        }
}
